﻿<!--////////////////////////////////////////////////////////////////////////////////
///名称：多媒休编辑器
///网址：http://www.avpx.net
///Edit By Mal
////////////////////////////////////////////////////////////////////////////////-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>插入图片</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<link rel="stylesheet" type="text/css" href="style/defaultEditor.css">
<script language="JavaScript">
function checkchange()
{
	if (document.getElementById('chkSize').checked){
		document.getElementById('width').disabled=false;
		document.getElementById('height').disabled=false;
	}
	else{	
	   document.getElementById('width').disabled=true;
	   document.getElementById('height').disabled=true;
	   document.getElementById('width').value = "";
	   document.getElementById('height').value = "";
	   showimage();
	}
}

function showimage(){
	sFromUrl = document.getElementById('imgurl').value;
	sBorder = document.getElementById('border').value;
	sAlign = document.getElementById('aligntype').value;
	sWidth = document.getElementById('width').value;
	sHeight = document.getElementById('height').value;
	var sHTML = '<img src="'+sFromUrl+'" border="'+sBorder+'" align="'+sAlign+'"';
	if (sWidth!=""){
		sHTML=sHTML+' width="'+sWidth+'"';
	}
	if (sHeight!=""){
		sHTML=sHTML+' height="'+sHeight+'"';
	}
	sHTML = sHTML+' />';
	if (sFromUrl.length<10) sHTML='';
	document.getElementById('showimage').innerHTML = sHTML;
}

//Show/Hide a DIV
function showhidediv(id){
  try{
    var panel=document.getElementById(id);
	var urlPic=document.getElementById("urlPic");
    if(panel){
      if(panel.style.display=='none'){
        panel.style.display='compact';
		urlPic.style.display='none';
      }else{
        panel.style.display='none';
		urlPic.style.display='compact';
      }
	}
  }catch(e){}
}

function image(){
var imghtml="";
var sUrl = document.getElementById('imgurl').value;
var sAlign = document.getElementById('aligntype').value;
var sAltText = document.getElementById('alttext').value;
var sBorder = document.getElementById('border').value;
var bchkSize = document.getElementById('chkSize').checked;
var sWidth = document.getElementById('width').value;
var sHeight = document.getElementById('height').value;

if (sUrl=="" || sUrl=="http://") return;
sType=sUrl.substring(sUrl.length-3,sUrl.length).toLowerCase();
if (sType=="jpg" || sType=="gif"){
  imghtml += "<img src='"+sUrl+"' align='"+sAlign+"'";
  if (sAltText != "") imghtml += " alt='" + sAltText + "'";
  if (sBorder != "") imghtml += " border='" + sBorder + "'";
  if (bchkSize){
    if (sWidth != "") imghtml += " width='" + sWidth + "'";
	if (sHeight != "") imghtml += " height='" + sHeight + "'";
	}
  imghtml += ">";
  window.returnValue = imghtml;
  }
window.close();
}
</script>
</Head>

<BODY>
<table cellpadding="0" cellspacing="0" class="modeMain" border="0">
<tr>
<td>
<div class="topTitle" align=left><span style="cursor:pointer;" onClick="showhidediv('upPic')">插入图片</span></div>
<table id="urlPic" cellpadding="5" cellspacing="0" width="400" border="0" align="center">
  <tr> 
    <td height="30" align="left">URL</td>
    <td height="30" colspan="3" align="left"><input name="imgurl" type="text" id="imgurl" value="http://" size="48" onKeyUp="showimage()"></td>
  </tr>
  <tr>
    <td align="left" width="15%">替换文字</td> 
    <td width="35%" height="30" align="left"><input name="alttext" type="text" id="alttext" size="18"></td>
    <td width="15%">对齐方式</td>
    <td width="35%" height="30"><select name="aligntype" id="aligntype" onChange="showimage();">
        <option value="" selected>默认</option>
        <option value="left">左对齐</option>
        <option value="right">右对齐</option>
        <option value="top">顶边对齐</option>
        <option value="texttop">文字上方</option>
        <option value="middle">相对垂直居中</option>
        <option value="absmiddle">绝对垂直居中</option>
        <option value="baseline">基线</option>
        <option value="bottom">相对底边对齐</option>
        <option value="absbottom">绝对底边对齐</option>
        <option value="center">居中</option>
      </select></td>
  </tr>
  <tr>
    <td align="left">图片大小</td> 
    <td height="30" align="left"><input name="chkSize" type="checkbox" id="chkSize" value="checkbox" onChange="checkchange();">
      <label for="chkSize">指定大小</label></td>
    <td>边框粗细</td>
    <td height="30"><input name="border" type="text" id="border" value="0" size="5" onpaste="return !clipboardData.getData('text').match(/\D/)" onKeyPress="event.returnValue=(event.keyCode>=48)&&(event.keyCode<=57);">
      像素</td>
  </tr>
  <tr>
    <td align="left">宽</td> 
    <td height="30" align="left"><input name="width" type="text" id="width" size="5" onpaste="return !clipboardData.getData('text').match(/\D/)" onKeyPress="event.returnValue=(event.keyCode>=48)&&(event.keyCode<=57);" onChange="showimage();" disabled>
      像素 </td>
    <td>高</td>
    <td><input name="height" type="text" id="height" size="5" onpaste="return !clipboardData.getData('text').match(/\D/)" onKeyPress="event.returnValue=(event.keyCode>=48)&&(event.keyCode<=57);" onChange="showimage();" disabled>
      像素</td>
  </tr>
  <tr>
    <td height="40" colspan="4" align="center"><input name="cmdOK" type="button" class="button" id="cmdOK" onClick="image();" value="确定"> 
      &nbsp;  <input name="close" type="button" class="button" id="close" onClick="window.close();" value="取消"></td>
  </tr>
</table>
</td>
</tr>
</table>
<div style="height:2px; line-height:2px;"></div>
<table cellpadding="0" cellspacing="0" class="modeMain" border="0">
<tr>
<td>

	<div class="topTitle" align=left>图片预览</div>
	<table cellpadding="0" cellspacing="0" border="0" width="400">
		<tr>
			<td height="150" id="showimage"></td>
		</tr>
	</table>

</td>
</tr>
</table>
</BODY></HTML>